#!/usr/bin/env bash
# SpringBoot项目 启动脚本通用
# shellcheck disable=SC2154
# shellcheck disable=SC2034
# shellcheck disable=SC2174
# shellcheck disable=SC2046
# shellcheck disable=SC2070
baseDir=$(readlink -f "$(dirname "$0")")
# jar包名称
packageName=ssh-remote-server.jar
# 项目名称
projectName=ssh-remote-server
# 配置文件选择
profileActive=110
# 配置文件选择
javaPath=/home/swyan/jdk-11.0.14/bin/
# 程序进程ID
pid=$("${javaPath}"jps | grep "${packageName}" | awk '{print $1}')
[ -n "${pid}" ] && kill "${pid}"
nohup "${javaPath}"java -jar -server -Xmx1024m -Xms512m -Xmn256m -Xss512k -Dsun.zip.disableMemoryMapping=true -Dspring.profiles.active="${profileActive}" "${baseDir}"/"${packageName}" >/dev/null 2>&1 &
echo "Process $! start Success!"
tail -f "${baseDir}"/logs/"${projectName}".log
